package com.wing.sell.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.wing.mybatis.common.BaseEntity;
import com.wing.purchase.model.entity.SupplierDue;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 尽调记录表
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("sel_customer_due")
public class CustomerDue extends BaseEntity<SupplierDue> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Result implements IEnum<Integer> {

        /**
        * 符合且可以通过
        */
        pass(0,"符合且可以通过"),
        /**
        * 符合在考察考察
        */
        check(1,"符合在考察考察"),
        /**
        * 不符合但可以通过
        */
        waitPass(2,"不符合但可以通过"),
        /**
        * 不符合
        */
        inconformity(3,"不符合");

        private int code;
        private String desc;

        Result(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum Status implements IEnum<Integer> {

        /**
        * 待审核
        */
        oncheck(0,"待审核"),
        /**
        * 初审通过
        */
        pass(1,"初审通过"),
        /**
         * 初审驳回
         */
        noPass(2,"初审驳回");

        private int code;
        private String desc;

        Status(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum CustomerType implements IEnum<Integer> {

        /**
         * 潜在客户
         */
        potential(1,"潜在客户"),
        /**
         * 意向客户
         */
        Intended(2,"意向客户"),
        /**
         * 正式客户
         */
        formal(3,"正式客户");

        private int code;
        private String desc;

        CustomerType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 尽调信息编号
     */
    private String code;

    /**
     * 所属客户ID
     */
    private Long customerId;

    /**
     * 客户类型
     */
    private CustomerType customerType;

    /**
     * 尽调分类ID
     */
    private Long categoryId;

    /**
     * 尽调科目ID
     */
    private Long subjectId;

    /**
     * 尽调科目描述
     */
    private String subjectDetail;
    /**
     * 尽调科目参数类型
     */
    private String subjectType;

    /**
     * 评估结果
     */
    private Result result;

    /**
    * 评估结果描述
    */
    @TableField(exist = false)
    private String resultDesc;

    public String getResultDesc() {
        return result == null ? null : result.getDesc();
    }

    /**
     * 审核人
     */
    private String auditor;

    /**
    * 审核时间
    */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime auditTime;

    /**
     * 整体评估描述
     */
    private String detail;

    /**
     * 状态
     */
    private Status status;

    /**
    * 状态描述
    */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * no
     */
    private Integer no;

    /**
     * day
     */
    private Integer day;

    /**
     * 尽调分类名称
     */
    @TableField(exist = false)
    private String categoryName;
    /**
     * 尽调科目名称
     */
    @TableField(exist = false)
    private String subjectName;
    /**
     * 附件
     */
    private String enclosure;
}
